﻿using UnityEngine;
using System.Collections;

public class ProjectileBehavior : MonoBehaviour
{

	public GameObject Shooter;
	
	public float SecondsAlive { get; set; }
	public float Damage { get; set; }

	private float fired = 0.0f;

	void Start()
	{
		fired = Time.time;
		this.renderer.sortingOrder = 3;
	}

	void Update()
	{
		if (Time.time > fired + SecondsAlive)
			Destroy(this.gameObject);
	}

	void OnTriggerStay2D(Collider2D col)
	{
		if (col.gameObject.CompareTag("map"))
			Destroy(gameObject);
	}

}